import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_05/action/states/dark_states.dart';
import 'package:provider/provider.dart';

/**
 * @describe 主题类
 * @author liuzhitong
 * */
class MyTheme {
  static DartState dartState;

  MyTheme(context) {
    dartState = dartState ?? Provider.of<DartState>(context);
  }

///  白色模式
  static Map<String, Color> colorLight = {
    'app_green': Color(0xFF019944),
    'bg': Color(0xFFF2F2F4),
    'colorBlack': Color(0xFF000000),
    'white': Color(0xFFFFFFFF),
    'text_select': Color(0xFF696674),
    'text_unselect': Color(0xFFBAB8C3),
    'ceshi': Color(0xFFff1111),
    'tab_bg': Color(0xFFFFFFFF),
    'text_color': Color(0xFF696674),
    'line_color': Color(0xFFF2F1F7),
  };


///  黑暗模式
  static Map<String, Color> colorDark = {
    'dark_app_green': Color(0xFF1C1C1E),
    'dark_bg': Color(0xFF000000),
    'dark_colorBlack': Color(0xFFFFFFFF),
    'dark_white': Color(0xFF1C1C1E),
    'dark_tab_bg': Color(0xFF1C1C1E),
    'dark_text_select': Color(0xFFC7C7CC),
    'dark_text_unselect': Color(0xFF696674),
    'dark_text_color': Color(0xFF696674),
    'dark_ceshi': Color(0xFFff11ff),
    'dark_line_color': Color(0xFF3B3B3D),
  };


  //主题
  ///  白色模式
  static Map<String, Brightness> brightlness = {
    'dark': Brightness.dark,
    'light':Brightness.light
  };

  /**
   *@describe 标准颜色，统一颜色
   * */
  Color getColor(String colorName) {
    String darkColor = "dark_" + colorName;
    return dartState.darkMode == 1
        ? colorLight[colorName]
        : colorDark[darkColor];
  }

  /**
   * @describe
  * 1:普通模式
  * 2:黑暗模式
  * */
  int getCurrentTheme() {
    return dartState.darkMode;
  }
}
